using System;
using Newtonsoft.Json;

namespace Dimebrain.TweetSharp.Model.Twitter.Converters
{
    public abstract class TwitterConverterBase : JsonConverter
    {
        public static bool IsNullable(Type t)
        {
            return t != null && (!t.IsValueType || IsNullableType(t));
        }

        public static bool IsNullableType(Type t)
        {
            if (t == null)
            {
                return false;
            }

            return (t.IsGenericType &&
                    t.GetGenericTypeDefinition() == typeof (Nullable<>));
        }

        
    }
}